package com.hnqcgczy.sgzShoop.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

// ctrl+/    alt+insert   alt+enter   ctrl+d   ctrl+x   .var   psvm+tab
// sout+tab
public class DbImpl implements IDb {
    private String URL="jdbc:mysql://localhost:3306/dujiaoshou?useSSL=false&serverTimezone=Hongkong&characterEncoding=utf-8&autoReconnect=true";
    private String UNAME="root";
    private String PWD="123456";
    static {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }


    @Override
    public Connection getConByMysql() throws SQLException {
        Connection connection = DriverManager.getConnection(URL, UNAME, PWD);

        return connection;
    }

    @Override
    public Connection getConByOralce() throws SQLException {
        return null;
    }

    public static void main(String[] args) {
        try {
            System.out.println(new DbImpl().getConByMysql().isClosed());
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }

    }

//    public DbImpl() {
//        try {
//            Class.forName("com.mysql.cj.jdbc.Driver");
//        } catch (ClassNotFoundException e) {
//            e.printStackTrace();
//        }
//    }
     //alt+insert



}
